{% extends 'TopxiaWebBundle:Coin:layout.html.twig' %}
{% block title %}{{'我的邀请码'|trans}} - {{ parent() }}{% endblock %}



{% set side_nav = 'my-invite-code' %}

{#
{% do load_script('topxiawebbundle/controller/coin/share') %}
{% set url = inviteInfomation_template %}
{% set message = ds|default('我正在%site%学习，邀请你也来体验下。')|trans({'%site%':setting('site.name')}) %}
{% set title = setting('site.name') %}
{% if setting('site.logo') %}
{% set picture = asset(setting('site.logo')) %}
{% else %}
{% set picture = asset('assets/img/default/MAIN_icon.png') %}
{% endif %}
#}

{% block main %}
  <div class="es-section">
  {% include 'TopxiaWebBundle:Coin:bill-bar.html.twig' %}
  {% if setting('invite.invite_code_setting') == 1 %}
    <p class="clearfix">
      <span class="label label-primary label-md mrl">{{'我的邀请码'|trans}}</span><span class="mrl text-xlg">{{code}}</span>
     
      {% if record == null %}
     
      <a  class="btn btn-primary btn-sm pull-right mlm" href="#modal" data-toggle="modal" id="writeInvite" data-url="{{ path('write_invitecode')}}">{{'TA的邀请码'|trans}}</a>   
      {% endif %}
     
      <a  class="btn btn-primary btn-sm pull-right" href="#modal" data-toggle="modal" data-url="{{ path('invite_promote_link')}}">{{'邀请好友'|trans}}</a>
    </p>
    {#
    <div class="clearfix">
      <span class="label label-primary label-md mrl">{{'我的邀请码'|trans}}</span><span class="mrl text-xlg">{{code}}</span>
    
      {% if record == null %}
      <a  class="btn btn-primary btn-sm pull-right mlm" href="#modal" data-toggle="modal" id="writeInvite" data-url="{{ path('write_invitecode')}}">{{'TA的邀请码'|trans}}</a>
      {% endif %}

      <div class="es-share top pull-right">
        <a  class="btn btn-primary btn-sm pull-right mlm dropdown-toggle" href="" data-toggle="dropdown">{{'邀请好友'|trans}}</a>
        <div class="dropdown-menu {% if right|default(false) %}pull-right{% endif %} js-social-share-params ml30-o" data-title="{{ title }}" data-summary="{{ summary|default('') }}" data-message="{{ message }}" data-url="{{ url }}" data-picture="{{ picture|default('') }}">
          <a href="javascript:;" class="js-social-share" data-cmd="weixin" title="{{'分享到微信'|trans}}" data-share="weixin" data-qrcode-url="{{ path('common_qrcode',{text:url}) }}"><i class="es-icon es-icon-weixin"></i></a>
          <a href="javascript:;" class="js-social-share" data-cmd="tsina" title="{{'分享到新浪微博'|trans}}" data-share="weibo"><i class="es-icon es-icon-weibo"></i></a>
          <a href="javascript:;" class="js-social-share" data-cmd="qq" title="{{'分享到QQ好友'|trans}}" data-share="qq"><i class="es-icon es-icon-qq"></i></a>
          <a href="javascript:;" class="js-social-share" data-cmd="qzone" title="{{'分享到QQ空间'|trans}}" data-share="qzone"><i class="es-icon es-icon-qzone"></i></a>
        </div>
      </div>
    </div>
    #}

    <br>
    <div class="alert alert-warning">
    {{'给TA分享您的邀请码或者邀请链接'|trans}}
    {% if setting('invite')|default(false) %}
      {% if setting('invite.promoted_user_value')|default(false)  %}
        {{'，TA注册后将获得%promoted_user_value%元优惠券'|trans({'%promoted_user_value%':inviteSetting.promoted_user_value})}}
      {% endif %}

      {% if setting('invite.promote_user_value')|default(false) %}
        ，
        {% if setting('invite.get_coupon_setting')|default(false) %}
            {{'TA在消费后您将获得%promote_user_value%元优惠券'|trans({'%promote_user_value%':inviteSetting.promote_user_value})}}
        {% else %}
            {{'同时您将获得%promote_user_value%元优惠券'|trans({'%promote_user_value%':inviteSetting.promote_user_value})}}
        {% endif %}
      {% endif %}
    {{'。'|trans}}
    {% else %}
    {{'。'|trans}}
    {% endif %}
    </div>

<table class="table table-striped table-hover" id="course-table" style="word-break:break-all;">
  <thead>
    <tr>
      <th>{{'邀请对象'|trans}}</th>
      <th>{{'邀请时间'|trans}}</th>
      <th>{{'邀请奖励'|trans}}</th>
      <th>{{'奖励获取时间'|trans}}</th>
    </tr>
  </thead>
  <tbody>
      {% for user in invitedUsers %}
      <tr>
        <td>{{user.nickname}}</td>
        <td>{{user.inviteTime|date('Y-m-d H:i:s')}}</td>
        <td>{{user.rewardRate|default('-')}}</td>
        <td>{{user.inviteRewardTime|default('-')}}</td>
      </tr>
      {% else %}
        <tr><td colspan="20"><div class="empty">{{'暂无邀请用户'|trans}}</div></td></tr>
      {% endfor %}
  </tbody>
</table>
  {{ web_macro.paginator(paginator) }}


  {% else %}
  <div class="well" style="text-align:center;">
    {{'邀请码功能已关闭'|trans}}
  </div>
  {% endif %}
  </div>
{% endblock %}